var local="http://47.104.10.151";
var bid_id1;
var bid_id7;
var bid_id6;
var bid_id5;
var bid_id4;
var bid_id3;
var bid_id8;
var bid_id9;
var bid_id10;
var bid_id2;
var user_id=getCookie('userId');
function getCookie(c_name)
{
    if (document.cookie.length>0)
    {
        c_start=document.cookie.indexOf(c_name + "=")
        if (c_start!=-1)
        {
            c_start=c_start + c_name.length+1
            c_end=document.cookie.indexOf(";",c_start)
            if (c_end==-1) c_end=document.cookie.length
            return unescape(document.cookie.substring(c_start,c_end))
        }
    }
    return ""
}

function createXMLHttpBid() {
    //使用大部分浏览器
    var xmlHttp;
    if(window.XMLHttpRequest){
        xmlHttp=new XMLHttpRequest();
    }
    if(window.ActiveXObject){
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        if(!xmlHttp){
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
        }
    }
    return xmlHttp;
}
//无参数GET请求
var xmlHttp_bid;
//通过鼠标点击事件创建HTTP请求
function onClickAjax_bid() {
    xmlHttp_bid=createXMLHttpBid();
    var url=local+":8080/bid/findBid2";//服务器URL
    var txt="page=0";
    xmlHttp_bid.open("POST",url,true);
    xmlHttp_bid.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp_bid.send(txt);
    xmlHttp_bid.onreadystatechange=function () {
    var result = xmlHttp_bid.responseText;
    var json = eval("(" + result + ")");


    var input11=document.getElementsByName("biding1");
    bid_id1=json.data.content[0].keyId;
    input11[0].value= json.data.content[0].bid_name;
    input11[1].value= json.data.content[0].model_code;
    input11[2].value= json.data.content[0].product_size;
    input11[3].value= json.data.content[0].bid_area;
    input11[4].value= json.data.content[0].inventory;
    if(json.data.content[0].tax_status==1){
        input11[5].value="16%";
    }else if(json.data.content[0].tax_status==0){
        input11[5].value="0%";
    }
    

     var input2=document.getElementsByName("biding2");
    bid_id2=json.data.content[1].keyId;
    input2[0].value= json.data.content[1].bid_name;
    input2[1].value= json.data.content[1].model_code;
    input2[2].value= json.data.content[1].product_size;
    input2[3].value= json.data.content[1].bid_area;
    input2[4].value= json.data.content[1].inventory;
    if(json.data.content[1].tax_status==1){
        input2[5].value="16%";
    }else if(json.data.content[1].tax_status==0){
        input2[5].value="0%";
    }


    var input3=document.getElementsByName("biding3");
    bid_id3=json.data.content[2].keyId;
    input3[0].value= json.data.content[2].bid_name;
    input3[1].value= json.data.content[2].model_code;
    input3[2].value= json.data.content[2].product_size;
    input3[3].value= json.data.content[2].bid_area;
    input3[4].value= json.data.content[2].inventory;
    if(json.data.content[2].tax_status==1){
        input3[5].value="16%";
    }else if(json.data.content[2].tax_status==0){
        input3[5].value="0%";
    }

    var input4=document.getElementsByName("biding4");
    bid_id4=json.data.content[3].keyId;
    input4[0].value= json.data.content[3].bid_name;
    input4[1].value= json.data.content[3].model_code;
    input4[2].value= json.data.content[3].product_size;
    input4[3].value= json.data.content[3].bid_area;
    input4[4].value= json.data.content[3].inventory;
    if(json.data.content[3].tax_status==1){
        input4[5].value="16%";
    }else if(json.data.content[3].tax_status==0){
        input4[5].value="0%";
    }

    var input5=document.getElementsByName("biding5");
    bid_id5=json.data.content[4].keyId;
    input5[0].value= json.data.content[4].bid_name;
    input5[1].value= json.data.content[4].model_code;
    input5[2].value= json.data.content[4].product_size;
    input5[3].value= json.data.content[4].bid_area;
    input5[4].value= json.data.content[4].inventory;
    if(json.data.content[4].tax_status==1){
        input5[5].value="16%";
    }else if(json.data.content[4].tax_status==0){
        input5[5].value="0%";
    }

    var input6=document.getElementsByName("biding6");
    bid_id6=json.data.content[5].keyId;
    input6[0].value= json.data.content[5].bid_name;
    input6[1].value= json.data.content[5].model_code;
    input6[2].value= json.data.content[5].product_size;
    input6[3].value= json.data.content[5].bid_area;
    input6[4].value= json.data.content[5].inventory;
    if(json.data.content[5].tax_status==1){
        input6[5].value="16%";
    }else if(json.data.content[5].tax_status==0){
        input6[5].value="0%";
    }

    var input7=document.getElementsByName("biding7");
    bid_id7=json.data.content[6].keyId;
    input7[0].value= json.data.content[6].bid_name;
    input7[1].value= json.data.content[6].model_code;
    input7[2].value= json.data.content[6].product_size;
    input7[3].value= json.data.content[6].bid_area;
    input7[4].value= json.data.content[6].inventory;
    if(json.data.content[6].tax_status==1){
        input7[5].value="16%";
    }else if(json.data.content[6].tax_status==0){
        input7[5].value="0%";
    }

    var input8=document.getElementsByName("biding8");
    stock_id8=json.data.content[7].keyId;
    input8[0].value= json.data.content[7].bid_name;
    input8[1].value= json.data.content[7].model_code;
    input8[2].value= json.data.content[7].product_size;
    input8[3].value= json.data.content[7].bid_area;
    input8[4].value= json.data.content[7].inventory;
    if(json.data.content[7].tax_status==1){
        input8[5].value="16%";
    }else if(json.data.content[7].tax_status==0){
        input8[5].value="0%";
    }



}
}





function creatxmlHTTP() {
    if(window.XMLHttpRequest){
//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
        xmlHttp=new XMLHttpRequest();
    }else {
        // IE6, IE5 浏览器执行代码
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

    return xmlHttp;
}


function creatxmlHTTP_voteBid() {
    if(window.XMLHttpRequest){
//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
        xmlHttp=new XMLHttpRequest();
    }else {
        // IE6, IE5 浏览器执行代码
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

    return xmlHttp;
}

function BidOrder1() {
    var url=local+":8080/voteBid/voteBidHomePage";
    xmlHttp=creatxmlHTTP_voteBid();
    var txt="";//用于存储拼接字符串；
    //拼接字符
    txt="user_id="+user_id+"&bid_id="+bid_id1;
    xmlHttp.open("POST",url,true);
    xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4 && xmlHttp.status==200)
        {
            var result=xmlHttp.responseText;
            var json=eval("("+result+")");
            var msg=json.msg;
            alert("竞标一："+txt);
            window.open('个人中心/HTML/Biding_results%20.html');
        }
    }


}


function BidWarn() {
  BootstrapDialog.alert('I want banana!');

}

function BidOrder2() {
    var url=local+":8080/voteBid/voteBidHomePage";
    xmlHttp=creatxmlHTTP_voteBid();
    var txt="";//用于存储拼接字符串；
    //拼接字符
    txt="user_id="+user_id+"&bid_id="+bid_id2;
    xmlHttp.open("POST",url,true);
    xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4 && xmlHttp.status==200)
        {
            var result=xmlHttp.responseText;
            var json=eval("("+result+")");
            var msg=json.msg;
            alert("竞标二："+msg);
            window.open('个人中心/HTML/Biding_results%20.html');
        }
    }

}
function BidOrder3() {
    var url=local+":8080/voteBid/voteBidHomePage";
    xmlHttp=creatxmlHTTP_voteBid();
    var txt="";//用于存储拼接字符串；
    //拼接字符
    txt="user_id="+user_id+"&bid_id="+bid_id3;
    xmlHttp.open("POST",url,true);
    xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4 && xmlHttp.status==200)
        {
            var result=xmlHttp.responseText;
            var json=eval("("+result+")");
            var msg=json.msg;
            alert("竞标三："+msg);
            window.open('个人中心/HTML/Biding_results%20.html');
        }
    }

}

function BidOrder4() {
    var url=local+":8080/voteBid/voteBidHomePage";
    xmlHttp=creatxmlHTTP_voteBid();
    var txt="";//用于存储拼接字符串；
    //拼接字符
    txt="user_id="+user_id+"&bid_id="+bid_id4;
    xmlHttp.open("POST",url,true);
    xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4 && xmlHttp.status==200)
        {
            var result=xmlHttp.responseText;
            var json=eval("("+result+")");
            var msg=json.msg;
            alert("竞标四："+msg);
            window.open('个人中心/HTML/Biding_results%20.html');
        }
    }

}

function BidOrder5() {
    var url=local+":8080/voteBid/voteBidHomePage";
    xmlHttp=creatxmlHTTP_voteBid();
    var txt="";//用于存储拼接字符串；
    //拼接字符
    txt="user_id="+user_id+"&bid_id="+bid_id5;
    xmlHttp.open("POST",url,true);
    xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4 && xmlHttp.status==200)
        {
            var result=xmlHttp.responseText;
            var json=eval("("+result+")");
            var msg=json.msg;
            alert("竞标五："+msg);
            window.open('个人中心/HTML/Biding_results%20.html');
        }
    }

}

function BidOrder6() {
    var url=local+":8080/voteBid/voteBidHomePage";
    xmlHttp=creatxmlHTTP_voteBid();
    var txt="";//用于存储拼接字符串；
    //拼接字符
    txt="user_id="+user_id+"&bid_id="+bid_id6;
    xmlHttp.open("POST",url,true);
    xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4 && xmlHttp.status==200)
        {
            var result=xmlHttp.responseText;
            var json=eval("("+result+")");
            var msg=json.msg;
            alert("竞标六："+msg);
            window.open('个人中心/HTML/Biding_results%20.html');
        }
    }

}

function BidOrder7() {
    var url=local+":8080/voteBid/voteBidHomePage";
    xmlHttp=creatxmlHTTP_voteBid();
    var txt="";//用于存储拼接字符串；
    //拼接字符
    txt="user_id="+user_id+"&bid_id="+bid_id7;
    xmlHttp.open("POST",url,true);
    xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4 && xmlHttp.status==200)
        {
            var result=xmlHttp.responseText;
            var json=eval("("+result+")");
            var msg=json.msg;
            alert("竞标七："+msg);
            window.open('个人中心/HTML/Biding_results%20.html');
        }
    }

}
function BidOrder8() {
    var url=local+":8080/voteBid/voteBidHomePage";
    xmlHttp=creatxmlHTTP_voteBid();
    var txt="";//用于存储拼接字符串；
    //拼接字符
    txt="user_id="+user_id+"&bid_id="+bid_id8;
    xmlHttp.open("POST",url,true);
    xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4 && xmlHttp.status==200)
        {
            var result=xmlHttp.responseText;
            var json=eval("("+result+")");
            var msg=json.msg;
            alert("竞标八："+msg);
            window.open('个人中心/HTML/Biding_results%20.html');
        }
    }

}
function BidOrder9() {
    var url=local+":8080/voteBid/voteBidHomePage";
    xmlHttp=creatxmlHTTP_voteBid();
    var txt="";//用于存储拼接字符串；
    //拼接字符
    txt="user_id="+user_id+"&bid_id="+bid_id9;
    xmlHttp.open("POST",url,true);
    xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4 && xmlHttp.status==200)
        {
            var result=xmlHttp.responseText;
            var json=eval("("+result+")");
            var msg=json.msg;
            alert("竞标九："+msg);
            window.open('个人中心/HTML/Biding_results%20.html');
        }
    }

}
function BidOrder10() {
    var url=local+":8080/voteBid/voteBidHomePage";
    xmlHttp=creatxmlHTTP_voteBid();
    var txt="";//用于存储拼接字符串；
    //拼接字符
    txt="user_id="+user_id+"&bid_id="+bid_id10;
    xmlHttp.open("POST",url,true);
    xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4 && xmlHttp.status==200)
        {
            var result=xmlHttp.responseText;
            var json=eval("("+result+")");
            var msg=json.msg;
            alert("竞标十："+msg);
            window.open('个人中心/HTML/Biding_results%20.html');
        }
    }

}